public class Test016 {
    public static void main(String[] args) {
        fac(18);
    }
    public static int fac(int n) {
        for (int i =31; i>=1;i-=2){
            System.out.print(((n >> i) & 1)+" ");
        }
        System.out.println();
        for (int i=30;i >= 0; i-=2){
            System.out.print(((n>>i) & 1)+" ");
       }
        return n;
    }
}